package com.ruoyi.system.controller;

import com.ruoyi.system.service.IAmapService;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwt;
import io.jsonwebtoken.JwtParser;
import io.jsonwebtoken.Jwts;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * @ClassName TestThreadLocal
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @Author luqian
 * @Date 2024/12/3 9:49 AM
 * @Copyright 八维
 * @Version V1.0.0
 */
@RestController
@RequestMapping("/testThreadLocal")
public class TestThreadLocal {

    @Autowired
    IAmapService amapService;

    @RequestMapping("test")
    String test(@RequestHeader("token")String token ){
        //需要获取用户的登录信息
        Claims claims = Jwts.parser().setSigningKey("1111").parseClaimsJwt(token).getBody();
        Integer userId = claims.get("userId", Integer.class);

        return amapService.test(userId);
    }



}
